<template>
  <div>

      <router-link class="nl" v-for="(item, index) in newsList" :key="index" :to="'/home/newsInfo/' + item.id">
        <div class="nl-l">
          <img :src="item.img_url">
        </div>
        <div class="nl-r">
          <p>{{item.title}}</p>
          <div>
            <p>发表时间：{{item.add_time | dateFormat}}</p>
            <span>点击：{{item.click}}次</span>
          </div>
        </div>
      </router-link>

  </div>
</template>

<script>
import { Toast } from "mint-ui";
export default {
  data() {
    return {
      newsList: []
    };
  },
  created() {
    this.getNewsList();
  },
  methods: {
    getNewsList() {
      this.$http.get("api/getnewslist").then(result => {
        if (result.body.status == 0) {
          this.newsList = result.body.message;
          Toast("数据加载成功");
        }
      });
    }
  }
};
</script>
<style lang="less" scoped>
.nl {
  width: 100%;
//   height: 80px;
  border-bottom: 1px solid rgb(39, 35, 35);
  display: flex;
  .nl-l {
    flex: 1;
    img {
      width: 100%;
    }
  }
  .nl-r {
    flex: 4;
    font-size: 10px;
    div {
      display: flex;
      p {
        flex: 3;
      }
      span {
        flex: 1;
      }
    }
  }
}
</style>

